<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/auth/templates/template.xhtml">
	<ui:define name="pageTitle">Lista de Pedidos Vendas</ui:define>
	<ui:define name="body">
		<f:view>
			<p:growl id="messages" autoUpdate="true" closable="true" />
			<h:form id="form">
				<h:panelGrid cellspacing="10px" styleClass="center">
					<f:facet name="header">Lista de Pedidos de Venda</f:facet>
					<p:dataTable id="vendas" value="#{vendaBean.pedidosVendas}"
						var="pedidoVenda"
						emptyMessage="Não existem registros para esta tabela"
						paginator="true" rows="10"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="5,10,15" styleClass="exp">
						<p:column headerText="Nº">
							<h:outputText value="#{pedidoVenda.idPedidoVenda}" />
						</p:column>
						<p:column headerText="Data">
							<h:outputText value="#{pedidoVenda.data.time}">
								<f:convertDateTime dateStyle="medium" type="date" />
							</h:outputText>
						</p:column>
						<p:column headerText="Valor">
							<h:outputText value="#{pedidoVenda.valor}">
								<f:convertNumber currencyCode="BRL" type="currency" />
							</h:outputText>
						</p:column>
						<p:column headerText="Ações">
							<p:commandButton update=":form" icon="ui-icon-trash"
								onclick="if(!confirm('Deseja realmente remover este pedido?')) return false;"
								title="Remover" action="#{vendaBean.removerPedidoVenda()}">
								<f:setPropertyActionListener value="#{pedidoVenda}"
									target="#{vendaBean.pedidoVenda}" />
							</p:commandButton>
							<p:commandButton update=":form" icon="ui-icon-circle-arrow-e"
								title="Continuar Venda"
								action="pedidovendavista?faces-redirect=true&amp;includeViewParams=true">
								<f:setPropertyActionListener value="#{pedidoVenda}"
									target="#{vendaVSBean.pedidoVenda}" />
							</p:commandButton>
						</p:column>
					</p:dataTable>
				</h:panelGrid>
			</h:form>
		</f:view>
	</ui:define>
</ui:composition>
</html>